<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // es6 是通过static来定义类自身的属性和方法

        class Person {
            // 定义类自身的属性
            static type = '人' ;
            constructor(name) {
                this.name = name ;
            }
            say() {
                console.log('say');
            }

            // 定义类自身的方法
            static speak() {
                console.log('speak');
            }
        }

        const p = new Person('cc') ;
        console.log(p.type);
        console.log(Person.type);

        // p.speak()
        Person.speak()

    </script>
    
</body>
</html>